// 页面加载结束时的操作
window.onload = function () {
  let input = document.getElementsByClassName('username')[0]
  let span = input.nextElementSibling
  input.value = 'hello kgc'
  // input获得焦点时
  input.onfocus = function () {
    let v = (this.value = '')
    this.style.color = 'red'
    if (v.length < 6 || v.length > 12) {
      span.innerHTML = '用户名 6-12 位'
    }
  }
}
